package com.zwan.oam_rtc.utils.messages;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;

import java.nio.ByteBuffer;

/***
 * 回调结果消息  
 * callflowId
 * callbackUrl
 * callstatus
 * @author 
 *
 */

public class SMSReportMessage extends AbstractStruct {
    
//    callflowid	Varchar2(20)
//    callbackurl	Varchar2(300)
//    Callstatus	Integer

    private byte[] messageBodyHeader = new byte[8];
    private byte[] callFlowId = new byte[50];
    private byte[] callBackUrl = new byte[300];
    private byte[] callStatus = new byte[4];
    private byte[] calling = new byte[29];
    private byte[] content = new byte[500];
    private byte[] companyid = new byte[10];


    private static int LENGTH = 324;
    
    /**
     * 返回消息写入buffer
     */
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(messageBodyHeader);
        bf.put(callFlowId);
        bf.put(callBackUrl);
        bf.put(callStatus);
        bf.put(calling);
        bf.put(content);
        bf.put(companyid);
    }

    /**
     * buffer读出返回消息
     */
    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(messageBodyHeader);
        bf.get(callFlowId);
        bf.get(callBackUrl);
        bf.get(callStatus);
        bf.get(calling);
        bf.get(content);
        bf.get(companyid);
    }

    public String getCallFlowId() {
        return ByteTransfer.getString(callFlowId);
    }

    public void setCallFlowId(String callFlowId) {
    	ByteTransfer.str2Byte(callFlowId, this.callFlowId);
    }
    
    public String getCallBackUrl() {
        return ByteTransfer.getString(callBackUrl);
    }

    public void setCallBackUrl(String callBackUrl) {
    	ByteTransfer.str2Byte(callBackUrl, this.callBackUrl);
    }

    public String getCallStatus() {
        return ByteTransfer.getString(callStatus);
    }

    public void setCallStatus(String callStatus) {
        ByteTransfer.str2Byte(callStatus, this.callStatus);
    }

    @Override
    public int getLength() {
        return LENGTH;
    }

    public String getCalling() {
        return ByteTransfer.getString(calling);
    }

    public void setCalling(String calling) {
        ByteTransfer.str2Byte(calling, this.calling);
    }

    public String getContent() {
        return ByteTransfer.getString(content);
    }

    public void setContent(String content) {
        ByteTransfer.str2Byte(content, this.content);
    }

    public String getCompanyid() {
        return ByteTransfer.getString(companyid);
    }

    public void setCompanyid(String companyid) {
        ByteTransfer.str2Byte(companyid, this.companyid);
    }


}
